import { request } from "@/utils/service"
import {
  PositionDataResponse,
  AduitPositionParams,
  AppendPositionParams,
  UpdatePositionFormParams,
  QueryPositionParams
} from "./type/index"

// 发布岗位
export function publishPosition(data: AppendPositionParams) {
  return request({
    url: "company/work/add",
    method: "post",
    data
  })
}

// 修改岗位
export function updatePosition(data: UpdatePositionFormParams) {
  return request({
    url: "company/work/update",
    method: "post",
    data
  })
}

// 删除岗位
export function deletePosition(id: number) {
  return request({
    url: "company/work/delete",
    method: "post",
    data: {
      id
    }
  })
}
// 查岗位
export function getPositionInformation(data: QueryPositionParams) {
  return request<PositionDataResponse>({
    url: "company/work/list/page/vo",
    method: "post",
    data
  })
}

// 审批岗位
export function aduitPosition(data: AduitPositionParams) {
  return request({
    url: "company/work/approval",
    method: "post",
    data
  })
}

// 用户获取职位推荐列表
export function getRecommendListByUser(data: QueryPaginationParams) {
  return request<PositionDataResponse>({
    url: "company/work/match/list/page/vo",
    method: "post",
    data
  })
}
